package com.kingpeng.myopengl;

import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import android.widget.LinearLayout;

import com.kingpeng.myopengl.one.OpenGLES20Activity;
import com.kingpeng.myopengl.one.OpenGLES20Activity2;

public class MainActivity extends AppCompatActivity {

    Class[] mClazz = new Class[]{
            OpenGLES20Activity.class,
            OpenGLES20Activity2.class,
    };

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        LinearLayout lyContain = findViewById(R.id.ly_contain);
        Button btn;
        for (final Class clazz : mClazz) {
            btn = new Button(this);
            btn.setText(clazz.getSimpleName());
            btn.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View view) {
                    startActivity(new Intent(MainActivity.this, clazz));
                }
            });
            lyContain.addView(btn);
        }
    }
}
